import { Card } from "antd";
import { data } from "../data";
import Link from "next/link";

interface DetailProps {
    params: Promise<{ id: string }>
}

export async function generateMetadata({ params }: DetailProps) {
    const { id } = await params;

    return {
        title: `文章详情-${id}`
    }

}

export default async function Page({ params }: DetailProps) {
    const { id } = await params;
    const detail = data.find((item) => item.id === +id);

    return (
        <Card title={detail?.title} extra={<Link href={"/article"}>列表页</Link>}>
            <p>{detail?.description}</p>
        </Card>
    )
}
